<?php
$this->layout("blog/base", $this->data);

$this->start("container");
?>
    <div class="">
        <div class="row align-items-start">
            <div class="col-md-3">
                <div class="list-group mb-4">
                    <h3 class="mb-4">文章归档</h3>
                    <select onchange="onselect_change(this)"
                            style="font-size: 1.2rem;border: none;overflow: auto;margin: 0;padding: 0;border-radius: 0;"
                            class="form-select" size="<?= min(count($ym), 10) ?>">
                        <?php foreach ($ym as $item): ?>
                            <option value="/blog/archive-<?= str_replace('.', '-', $item) ?>.html" <?php if ($now_ym == $item) echo 'selected' ?>>
                                <?= $item ?>
                            </option>
                        <?php endforeach; ?>
                    </select>
                </div>
            </div>
            <script>
                function onselect_change(_this) {
                    console.log(_this)
                    var index = _this.selectedIndex;
                    var selectedValue = _this.options[index].value;
                    location.href = selectedValue;
                }
            </script>
            <div class="col-md-9">
                <h3 class="mb-4">归档日期：<?= str_replace('.', '年', $item) ?>月</h3>
                <?php $this->insert("blog/part_art_list", $this->data);
                if (!$container) {
                    echo '没有找到这一天的文章';
                }
                ?>
            </div>
        </div>
    </div>

<?php
$this->stop();